package cn.tedu.ivosback.audit.controller;

import cn.tedu.ivosback.audit.pojo.dto.AuditParam;
import cn.tedu.ivosback.audit.pojo.dto.AuditSaveParam;
import cn.tedu.ivosback.audit.pojo.vo.AuditVO;
import cn.tedu.ivosback.audit.service.AuditService;
import cn.tedu.ivosback.base.response.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("v1/audit")
public class AuditController {
    @Autowired
    AuditService auditService;

    @GetMapping("select")
    public JsonResult selectAudit(AuditParam auditParam) {
        log.debug("查询审批记录:auditParam={}", auditParam);
        List<AuditVO> list = auditService.selectAudit(auditParam);
        return JsonResult.ok(list);
    }

    @PostMapping("update")
    public JsonResult updateAudit(AuditSaveParam auditSaveParam) {
        log.debug("更新审批记录:auditSaveParam={}", auditSaveParam);
        auditService.updateAudit(auditSaveParam);
        return JsonResult.ok();
    }
}
